package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.IUserCommentDao;
import com.guoxue.domain.UserCommentVo;
@Repository
public class UserCommentDaoImpl extends BaseDaoImpl<UserCommentVo> implements IUserCommentDao{

	@Override
	public void saveComment(UserCommentVo vo) {
		saveOrUpdate(vo);
	}

	@Override
	public List<UserCommentVo> getCommentByOrder(int begin, int count, int tapesId) {
		String sql = "SELECT u.id, u.commitDate, u.tapesId, u.uid, u.userComment"
				+ " FROM userCommentvo u WHERE u.tapesId=? AND u.sysflag=0 ORDER BY u.commitDate DESC";
		return super.getComment(sql,begin,count,tapesId);
	}

	@Override
	public List<UserCommentVo> getCommentByOrderAndDate(int start, int total, int tapesId, String date) {
		String sql = "SELECT u.id, u.commitDate, u.tapesId, u.uid, u.userComment"
				+ " FROM userCommentvo u WHERE u.tapesId=? AND u.commitDate<=? AND u.sysflag=0 ORDER BY u.commitDate DESC";
		return super.getComment(sql,start,total,tapesId,date);
	}

}
